<%--
  Created by IntelliJ IDEA.
  User: 1daon
  Date: 2019/1/18
  Time: 17:28 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <jsp:include page="../common/backend_head.jsp"/>
    <style type="text/css">
        a {
            color: #fff;
        }
        a:hover {
            color: #FFB800;
        }
    </style>
</head>
<body></body>
<jsp:include page="../common/backend_script.jsp"/>
<script type="text/javascript">
    // 跳转等待时间（秒）
    var waitTime = 3;
    var msg = '用户长时间未操作，请重新登录！<br />(<span id="time">' + waitTime + '</span> 秒后自动跳转到登录页面)<br /><a href="javascript:void(0);" onclick="goto_login();">点击直接跳转到登录页</a>';
    var index = layer.msg(msg, {
        time: waitTime * 1000,
        shade: 0.3,
        success: function(layero, index) {
            // var msg = layero.text();
            var i = waitTime;
            var timer = null;
            var fn = function() {
                $('#time').html(i);
                if (!i) {
                    layer.close(index);
                    clearInterval(timer);

                    goto_login();
                }
                i--;
            };
            timer = setInterval(fn, 1000);
            fn();
        },
    });

    function goto_login() {
        layer.close(index);
        if (self.frameElement && self.frameElement.tagName == "IFRAME") {
            if(parent.frameElement && parent.frameElement.tagName == "IFRAME") {
                if(parent.parent.frameElement && parent.parent.frameElement.tagName == "IFRAME") {
                    parent.parent.parent.window.location.href = '/sys/login';
                } else {
                    parent.parent.window.location.href = '/sys/login';
                }
            } else {
                parent.window.location.href = '/sys/login';
            }
        } else {
            window.location.href = '/sys/login';
        }
    }
</script>
</html>
